<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>登录-格子铺管理系统</title>
<script type="text/javascript" charset="utf-8" src="../script/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
	
	jQuery().ready(function (){
	
		//点击登录按钮
		$("#loginsubmit").click(function (e)
		{
			var username = $("#username").val();
		   	var password = $("#passwd").val();
		   
		   	var datastore={"username":username,"password":password};
		   
		   	$.ajax({      
			    url:'adminlogin.htm',      
			    type:'post',      
			    data:datastore,    
			    async : false, //默认为true异步      
			    error:function(){   
			    	$("#error").empty();//清空
			    	$("#error").append("<span style='color: #ff2023;'>"+登录失败+"</span>");
			    	//alert("登录失败！");  
			    },      
			    success:function(data){     
			    	var d = eval("("+data+")");//将数据转换成json类型
					//alert(d.msg+"--"+d.success);
					if(d.success){
						window.location.href = '../index.jsp';
					}else{
						$("#error").empty();//清空
						$("#error").append("<span style='color: #ff2023;'>"+d.msg+"</span>");
					}			
			    }   
			});  
		   	e.preventDefault();
		});
	});
	
</script>
</head>
<body>
	<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
    		<tr>
    			<td height="150">&nbsp;</td>
    		</tr>
    		<tr>
    			<td align="center" valign="top">
    				<table width="500" height="172" border="0" cellspacing="0" cellpadding="0" class="table_border">
			    	  <tr>
			    	  	<td colspan="3">&nbsp;</td>
			    	  </tr>
			    	  <tr>
			    	  	<td colspan="3" align="center">
			    	  		<span style="font-size: 18px;">格子铺管理后台</span>
			    	  	</td>
			    	  </tr>
			    	  <tr>
			    	  	<td colspan="3" align="center">
			    	  	<div id="error" ></div>
			    	  	
						</td>
			    	  </tr>
			    	  <tr>
			    	  	<td colspan="3">&nbsp;</td>
			    	  </tr>
					  <tr>
					    <td width="85" align="right">用户名：</td>
					    <td width="8">&nbsp;</td>
					    <td width="232"><input id="username" name="username" type="text" maxlength="20" style="width:150px;"/></td>
					  </tr>
					  <tr>
					    <td align="right">密&nbsp;&nbsp;码：</td>
					    <td>&nbsp;</td>
					    <td><input id="passwd" name="password" type="password" maxlength="16" style="width:150px;"/></td>
					  </tr>
					  <tr>
					    <td height="43" colspan="3" align="center">
					      <input id="loginsubmit" type="button" name="loginsubmit" value="登录" style="width:80px;height:30px;"/>
				        </td>
					  </tr>
					</table>
    			</td>
    		</tr>
    	</table>
    	<div id='loading' style="display:block;position:absolute;"></div> 
</body>
</html>